<template>
	<fieldset>
		<legend>详情页</legend>
        <img :src="info.imgSrc" alt="">
        <h1>{{info.productInfo2}}</h1>
        <h3>{{info.productInfo1}}</h3>
	</fieldset>
</template>
<script>
    export default {
        props:['id'],
        data(){
            return {
                info:{}
            }
        },
        created(){
            // console.log(this.$route)
            console.log(this.id)
            //解构赋值
            // let {id} = this.$route.params;
            let id = this.id;
            //发送请求 根据传递过来的id 向服务器发起请求 获取列表详情的数据
            fetch("http://chst.vip:1234/api/getmoneyctrlproduct?productid="+id)
            .then(body=>body.json())
            .then(res=>{
                console.log(res)
                this.info = res.result[0]
                //给info多添加一个属性
                this.info.imgSrc = this.$route.query.imgSrc
            })
        }
    }
</script>